package org.example.循环;

import java.util.ArrayList;
import java.util.List;

/**
 * @author mumucgq
 * @create 2020-12-22 16:06
 */
public class ForRemoveTest {
    public static void main(String[] args) {
        List<String> userNames = new ArrayList<String>() {{
            add("Hollis");
            add("hollis");
            add("HollisChuang");
            add("H");
        }};

        for (String userName : userNames) {
            if (userName.equals("Hollis")) {
                userNames.remove(userName);
                //break;
            }
        }
        System.out.println(userNames);
    }
}
